﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrderManager
{
    [Serializable]
    public class Order
    {
        public int Id { get; set; }
        public Customer customer { get; set; }
        public Stuff stuff { get; set; }

        public override bool Equals(object? obj)
        {
            Order o = obj as Order;
            return (o != null &&  o.customer.CustomerName == customer.CustomerName && 
                o.stuff.StuffType == stuff.StuffType && o.stuff.TotalPrice == o.stuff.TotalPrice)||(o.Id == Id);
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(Id,customer,stuff);
        }
        
        public override string ToString()
        {
            return "Order ID:" + Id + "\t" + customer.ToString() + "\t" + stuff.ToString();
        }
    }
}
